package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;

public class UserController2 {
    private UserService userService;
    @Autowired
    public UserController2(UserService userService) {
        this.userService = userService;
    }
@Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }//set方法

    public void sayHi(){
        System.out.println("hi,UserController2...");
        userService.sayhi();
    }
}
